package com.yh.csx.event.store.config;

import com.yh.csx.bsf.core.config.BsfConfiguration;
import com.yh.csx.bsf.core.http.DefaultHttpClient;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhangsheng
 * @date 2021/8/20 17:43
 */
@Configuration
@AutoConfigureBefore(BsfConfiguration.class)
public class EventAutoConfiguration {

    @Bean("eventHttpClient")
    public DefaultHttpClient getDefaultHttpClient() {
        if (DefaultHttpClient.Default == null || DefaultHttpClient.Default.isClose()) {
            DefaultHttpClient.initDefault();
        }
        return DefaultHttpClient.Default;
    }

}
